package com.abel.bigwater.dataserver.model.ewide

/**
 * 一次会话中，响应包必须具备响应码，响应码的值规定如下：
 */
enum class SessionReponseType(val code: Byte, val fmt: String) {
    Success(0, "同意接收"),
    Failure(1, "拒绝接收"),
    CommErr(2, "通讯异常"),
    BadCrc(3, "CRC 出错"),
    BadTermCode(4, "终端编码错误"),
    BadEvent(5, "事件码错误"),
    BadParam(6, "参数类型错误"),
    OtherError(0xEE.toByte(), "其他错误");

    companion object {
        fun findByCode(code: Byte) = values().find { it.code == code }
    }
}